﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StatusFormThread.cs" company="SmartPlan">
//   SmartPlan 2011
// </copyright>
// <summary>
//   Defines the StatusFormThread type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DbDiff.WinClient.Helper
{
    using System.Windows.Forms;
    using Forms.Status;

    /// <summary>
    /// The status form thread.
    /// </summary>
    public class StatusFormThread : FormThread 
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="StatusFormThread"/> class.
        /// </summary>
        /// <param name="form">
        /// The form.
        /// </param>
        /// <param name="parentForm">
        /// The parent form.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="statusInfos">
        /// The status infos.
        /// </param>
        public StatusFormThread(FrmItemLoadStatus form, Form parentForm, string title,
                                EventStatusInfoCollection statusInfos)
            : base(form, parentForm)
        {
            // ((FrmItemLoadStatus)_form).Init(title, statusInfos, false);
        }

        #endregion Constructors

        /// <summary>
        /// The show.
        /// </summary>
        public override void Show() 
        {
            try 
            {
                Control.CheckForIllegalCrossThreadCalls = false;
                base.Show();
            }
            finally 
            {
                this._parentForm.Enabled = true;
            }
        }

        /// <summary>
        /// The hide.
        /// </summary>
        public override void Hide() 
        {
            this._parentForm.Enabled = true;
            ((FrmItemLoadStatus)this._form).HideForm();
        }

        /// <summary>
        /// The init.
        /// </summary>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="statusInfos">
        /// The status infos.
        /// </param>
        public void Init(string title, EventStatusInfoCollection statusInfos) 
        {
            // ((frmItemLoadStatus) _form).Init(title, statusInfos);
        }

        /// <summary>
        /// The set event status.
        /// </summary>
        /// <param name="eventStatusId">
        /// The event status id.
        /// </param>
        /// <param name="state">
        /// The state.
        /// </param>
        /// <param name="result">
        /// The result.
        /// </param>
        public void SetEventStatus(string eventStatusId, EventState state, EventResult result) 
        {
            ((FrmItemLoadStatus) this._form).SetEventStatusState(eventStatusId, state, result);
        }
    }
}